package org.leaf.pethome.controller;

import org.leaf.pethome.business.entity.PetUser;
import org.leaf.pethome.business.service.PetUserService;
import org.leaf.pethome.common.entity.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class PetUserController {
    private PetUserService petUserService;

    @Autowired
    public PetUserController(PetUserService petUserService) {
        this.petUserService = petUserService;
    }

    @PostMapping("/login")
    public Message userLogin(PetUser petUser){
        return petUserService.userLogin(petUser);
    }

    @PostMapping("/signIn")
    public Message userSignIn(PetUser petUser){
        return petUserService.userSignIn(petUser);
    }

    @GetMapping("/test")
    public Message show(){
        return petUserService.show();
    }
}
